<template>
	<sw-common-frame :count="dataCount" :loading="loading">
		<el-form slot="query" size="small" inline>
			<el-form-item>
				<el-input v-model="queryData.name" clearable placeholder="请输入名称" style="width: 180px"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" icon="el-icon-search" @click="handleQueryTableData()">查询</el-button>
			</el-form-item>
		</el-form>
		<el-table slot="table" :data="tableData" height="100%" stripe>
			<el-table-column label="排序" type="index" width="50" align="center"></el-table-column>
			<el-table-column label="纠错网页地址" prop="url" min-width="320"></el-table-column>
			<el-table-column label="错误类型" prop="errorType" min-width="120"></el-table-column>
			<el-table-column label="创建人" prop="sysUser.userName" width="120"></el-table-column>
			<el-table-column label="创建时间" prop="createTime" width="160"></el-table-column>
			<el-table-column label="操作" width="186">
				<el-button-group slot-scope="{ row }">
					<el-button size="mini" type="success" @click="handleReplyData(row)">回复</el-button>
					<el-button size="mini" type="warning" @click="handleLookDetail(row)">详情</el-button>
					<el-button size="mini" type="danger" @click="handleDeleteData(row)">删除</el-button>
				</el-button-group>
			</el-table-column>
		</el-table>
		<sw-pagination slot="page" :total="dataCount" :page.sync="queryData.page" :limit.sync="queryData.limit" @change="queryTableData()" />
		<correction-detail v-model="detailDialog" :data="detailData"></correction-detail>
		<correction-reply v-model="replyDialog" :data="detailData"></correction-reply>
	</sw-common-frame>
</template>

<script>
import correctionReply from './reply';
import correctionDetail from './detail';
import listMixins from '@/mixins/listMixins';
import { queryCorrectionList, deleteCorrection } from '@/api/basedata/sysErrorCorrection';
export default {
	mixins: [listMixins],
	components: { correctionReply, correctionDetail },
	data() {
		return {
			pageName: '纠错',
			detailDialog: false,
			replyDialog: false,
			detailData: {}
		};
	},
	computed: {
		listFunction() {
			return eval(queryCorrectionList);
		},
		deleteFunction() {
			return eval(deleteCorrection);
		}
	},
	methods: {
		handleLookDetail(data) {
			this.detailDialog = true;
			this.detailData = { ...data };
		},

		handleReplyData(data) {
			this.replyDialog = true;
			this.detailData = { ...data };
		}
	}
};
</script>

<style lang="scss" scoped></style>
